package com.mybatis04.util;

import com.mybatis04.bean.Student;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;

/**
 * @Author: zhaoxb
 * @Date: 2019-08-21 11:05
 * @Version 1.0
 **/
public class MyObjectFactory extends DefaultObjectFactory {

    @Override
    public Object create(Class type) {
        if (Student.class == type) {
            // 依靠父类提供的create方法实例化Dept对象
            Student student = (Student) super.create(type);
            student.setFrom("haizeiwang");
            return student;
        }
        return super.create(type);
    }
}
